#include <iostream>
#include <stdio.h>
using namespace std;

int f[2000], a[2000], n;
int main()
{
	freopen("lis.in", "r", stdin);
	freopen("lis.out", "w", stdout);
	cin >> n;
	for(int i=1; i<=n; ++i) {
		cin >> a[i];
	}
	for(int i=n; i>=1; i--) {
		for(int j=i; j<=n; j++) {
			if(a[j]<=a[i]) {
				f[i] = max(f[i],f[j]);
			}
		}
		f[i] = f[i]+1;
	}
	int ans=0;
	for(int i=1; i<=n; ++i) {
		if(ans<f[i]) {
			ans=f[i];
		}
	}
	cout << ans << endl;
}
